<?php

/**
 * Description of Helpers_HeadCategories
 *
 * @author a.novikov
 */
class Helpers_HeadCategories extends Helpers_Base {

	public function getViewPath($level = 0) {
		$level = (int)$level;

		switch ($level) {
			case 0:
				return 'head_categories.tpl';
			case 1:
				return 'head_categories_firstlevel.tpl';
			case 2:
				return 'head_categories_secondlevel.tpl';
			default :
				throw new Exception('Unsupported level');
		}
	}

	public function headCategories($name) {
		 $tree = CategoryService::getInstance()->getCategoryAsTree();
		 $this->view->category_tree = $tree;
		if (Debug::getInstance()->isDebugMode()) {
			//print_r($this->view->category_tree);
		}
		
		return $this->view->render($name);
	}
	
	
 	public function setView(Zend_View_Interface $view)
    {
        $this->view = $view;
        return $this;
    }
}